/**
 * 接口的基准地址
 */
export const serverUrl = "http://localhost:1337";
// 在本地存入token
export const setToken = (token: string) => localStorage.setItem("token", token);
//获取token
export const getToken = () => {
  //console.log(123);
  return localStorage.getItem("token");
}
//删除token
export const remToken = () => localStorage.removeItem("token");
/**
 * 上传文件的地址
 */
export const uploadUrl = serverUrl + "/api/v1/common/upload_file";
/**
 * 处理图片
 * @param url 
 * @returns 
 */
export const dalImg = (url: string | undefined)=>{
  if (url) {
    // console.log(url)
    if (url.startsWith("http")) return url;
    return serverUrl + url;
  }
  //如果没有url则返回一个默认的图片
  return "https://img1.baidu.com/it/u=3979391043,266749828&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500";
}